#include <iostream>
using namespace std;
int main()
{int k,m,n;
 cin>>k;
 for(int i=1;i<=k;i++)
  {cin>>m>>n;
   if(m<n) {cout<<"NO BRAINS"<<endl;continue;}
   else cout<<"MMM BRAINS"<<endl;
}
//system ("pause");
return 0;
}
